package com.moetube.video.feign;

import com.moetube.entity.Result;
import com.moetube.video.pojo.Video;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@FeignClient(name = "video")
@RequestMapping("/video")
public interface VideoFeign {

    @GetMapping("/{id}")
    Result<Video> findById(@PathVariable("id") String id);

    /**
     * 查询全部数据
     * @return
     */
    @GetMapping
    public Result<List<Video>> findAll();

    /***
     * 新增数据
     * @param video
     * @return
     */
    @PostMapping
    public Result add(@RequestBody Video video);
    /***
     * 修改数据
     * @param video
     * @param id
     * @return
     */
    @PutMapping(value="/{id}")
    public Result update(@RequestBody Video video,@PathVariable("id") String id);

    /***
     * 根据ID删除品牌数据
     * @param id
     * @return
     */
    @DeleteMapping(value = "/{id}" )
    public Result delete(@PathVariable("id") String id);
    /***
     * 多条件搜索品牌数据
     * @param searchMap
     * @return
     */
    @GetMapping(value = "/search" )
    public Result findList(@RequestParam Map searchMap);
    /***
     * 分页搜索实现
     * @param searchMap
     * @param page
     * @param size
     * @return
     */
    @GetMapping(value = "/search/{page}/{size}" )
    public Result findPage(@RequestParam Map searchMap, @PathVariable("page")  int page, @PathVariable("size")  int size);
}
